﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TravellerLib {
  /// <summary>
  /// A class to represent a subsector.
  /// </summary>
  public class SubSector {
    /// <summary>
    /// Gets or sets the name.
    /// </summary>
    /// <value>
    /// The name.
    /// </value>
    public string Name { get; set; }
    /// <summary>
    /// Gets the parent.
    /// </summary>
    /// <value>
    /// The parent.
    /// </value>
    public Sector Parent { get; private set; }
    /// <summary>
    /// Gets the sector part (A-P) of the parent sector.
    /// </summary>
    /// <value>
    /// The sector part.
    /// </value>
    public char SectorPart { get; private set; }
    private Dictionary<Tuple<int, int>, StarSystem> _systems;
    /// <summary>
    /// Gets the systems.
    /// </summary>
    /// <value>
    /// The systems.
    /// </value>
    public IDictionary<Tuple<int, int>, StarSystem> Systems { get { return _systems; } }
    /// <summary>
    /// Initializes a new instance of the <see cref="SubSector" /> class.
    /// </summary>
    /// <param name="parent">The parent.</param>
    /// <param name="name">The name.</param>
    /// <param name="ss">The sector part.</param>
    public SubSector(Sector parent, string name = "", char ss = 'A') {
      Name = name;
      Parent = parent;
      SectorPart = char.ToUpper(ss);
      _systems = new Dictionary<Tuple<int, int>, StarSystem>();
    }

    /// <summary>
    /// Returns a <see cref="System.String" /> that represents this instance.
    /// </summary>
    /// <returns>
    /// A <see cref="System.String" /> that represents this instance.
    /// </returns>
    public override string ToString() {
      return "Subsector: " + Name;
    }
  }
}
